Beginning code on the Source.
The best place to begin is at the beginning. The entire program is given in
the previous example, so I will simply speak to that code, in blocks.
Some of the algorithms and methods should be explained, to reduce problens
that would otherwise present themselves if not forwarned about some of the
code that is not generally considered conventional.
Refer to your RQDOCS folder along with this tutorial. You made a shortcut to the
contents file earlier, so it will be easy for you to research it.
First is the banner statements that may be whatever you wish.
Next are two resource statements. You are already familiar with $TYPECHECK ON.
it has saved me hours of trouble shooting because of typos alone.
The $Include uses definitions in the RAPIDQ.INC file for compiling. Make it a
comment statement to see the error message that results at compile time.
(don't forget to uncomment the $INCLUDE statement when your done playing)
<< FileStream.Open( FNAME$, fmOpenRead) in our code is an example. >>
fmOpenRead replaces the numeric argument otherwise needed.
Open RAPIDQ.INC with your text editor and see where fmOpenRead is defined.
Includes make the code more readable and is mandatory for using other programmer's
source code. You will find many of thes includes as you update your RAPIDQ folder.
Get them. Other includes permit using words like RED instead of &h0000FF.
Define your sub-routines so the compiler can allocate space for them in the exe file.
RQDOCS talks a lot about them. For example, make certain the parameters defined within
the parens are exactly the same in the DECLARE statement as they are in the SUB
statements. Otherwise, you will be scolded at best when you compile.
Some of the subs are un-necessary. I put them in place for experimenting with the
program. The temp sub, the temp QEDIT and temp QButton are examples. The temp sub
permits me to easily interact with the program during run time. You will probably
want to remove it when you are satisfied with your own editing and development.
Then comes the Variables. I have dimensioned more variables than is usually used.
It makes it easier for developing. Many can be removed later if you wish. Many
need not be declared Globaly here because they can be defined in the sub-routines.
I like to declare them globally because its easier to talk about them here.
RQDOCS points out a lot about using variables. There are a lot of things that we
can get away with by using them improperly; however it can result in some very
difficult problems to troubleshoot. For example, "$TYPECHECK OFF" will permit
using variables without dimensioning them first, but will warn you if it is ON.
It is far better to use them conventionally. The compiler will take you literally
whether you mean what you say, or not.
Softalk
There isn't much to say here that hasn't already been said. The functionality of the
sub-routines and the somewhat cryptic variable names will be explained in detail in
later pages. In any case, much of the program has already been covered. You will
undoubtedly use variable names that you associate with rather then mine. Its easy to
use search and replace in the text editor to change the name of any variable if you
wish to do so. Just be careful that you don't rename a variable to a name that is
already in use because it will be duplicated within the program. I always keep a copy
of the program as back-up for just a contingency. Constant back-up has proved to be
quite helpful for me on many occasions, if only for reference to how I did things
yesterday. In any case, change things as you wish and see what happens. You are almost
certain to make the program more comfortable for yourself. For example, I have a
variable I named workaround because I am using it to do something that can be done
much more elegantly using the "IN FOCUS" statement. However; it would be using an
$INCLUDE that we haven't been exposed to yet in our tutorial.
happy hacking